<?php


namespace App\Services\Game;


use App\DTOS\Admin\GameChannelDTO;
use App\Models\Game\GameChannel;

class GameChannelService
{
    public function paginate(GameChannelDTO $DTO){
        $model = GameChannel::query();
        $pageSize = $DTO->getLimit();
        $page = $DTO->getPage();
        $name = $DTO->getName();
        if ($name){
            $model->where('name','like',"%{$name}%");
        }
        return $model->orderByDesc('id')->paginate($pageSize,'*','page',$page);
    }
}
